import Vue from 'vue'
import Router from 'vue-router'

import Main from '../view/main'
import login from '../view/Login'

import Profile from '../view/User/profile'
import userlist from '../view/User/list'
import notfound from '../view/notFound'

Vue.use(Router);

export default new Router({
  mode: 'history',
  routes: [
    {
      // path: '/main/:name',
      path: '/main',
      component:Main,
      props: true,
      //  嵌套路由
      children: [
        {path: '/user/profile/:id', name: 'Userprofile', component: Profile,props:true},
        {path: '/user/userlist',component: userlist}
      ]
    },
    {
      path: '/login',
      component:login

    },
    {
      path: '/gohome',
      redirect: '/main'
    },
    {
      path: '*',
      component: notfound
    }
  ]
});

